package action.user;

import java.util.List;

import persistence.model.TdfkfaDeclareUnit;
import presentation.PageVO;
import service.UnitService;

import com.opensymphony.xwork2.ActionSupport;

public class ListUnitAction extends ActionSupport {

	private static final long serialVersionUID = -6400914804315882775L;

	private PageVO pageVO;

	private List<TdfkfaDeclareUnit> unitList;

	private UnitService unitService;

	public String listUnit() throws Exception {

		pageVO.setRecordNum(unitService.countUnit());

		unitList = unitService.getUnitList(pageVO.getIntPageIndex(), pageVO.getIntPageSize());

		return SUCCESS;
	}

	public String loadAllUnit() throws Exception {
		unitList = unitService.getUnitList(1, 0);
		return SUCCESS;
	}

	public PageVO getPageVO() {
		return pageVO;
	}

	public void setPageVO(PageVO pageVO) {
		this.pageVO = pageVO;
	}

	public void setUnitService(UnitService unitService) {
		this.unitService = unitService;
	}

	public List<TdfkfaDeclareUnit> getUnitList() {
		return unitList;
	}

}
